﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!DOCTYPE xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="Generator" content="PowerTools for Open XML" />
    <title>My Page Title Wednesday, December 08, 2010 2:06:43 AM</title>
  </head>
  <body>
    <h1>WordWalkingStick Flat-OPC-to-HTML Conversion</h1>
    <p>This <code>*.docx</code> file was generated by <code>OpenXmlUtility.GenerateOfficeDocument(package)</code> which implies that it has no local styles or effects. It depends <em>entirely</em> on the styles and settings of the opening Word application. Eric White’s original <code>HtmlConverter</code> (used in <a href="http://powertools.codeplex.com/" title="Important Note: For the Html Converter source code, click on the Downloads tab, and download HtmlConverter.zip">Open XML Power Tools</a> for PowerShell) has been enhanced and is included in the WordWalkingStick utility (a VSTO add-in). This utility will convert a Word 2010 document to HTML adding support for the following:</p>
    <ul>
      <li>Selected Word 2010 Document Formatting</li>
      <li>Selected Word 2010 Document Styles</li>
      <li>Selected Characters</li>
      <li>Content Control “Micro-Formats”</li>
    </ul>
    <h2>Selected Word 2010 Document Formatting</h2>
    <table class="WordWalkingStickTable">
      <tr>
        <td>
          <p>Bold</p>
        </td>
        <td>
          <p>The word <strong>here</strong> should be bold.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Italic</p>
        </td>
        <td>
          <p>The word <em>here</em> should be italic.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Underline</p>
        </td>
        <td>
          <p>The word <span style="text-decoration:underline;">here</span> should be underline.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Strikethrough</p>
        </td>
        <td>
          <p>
            <span style="text-decoration:line-through;">This entire sentence should be marked strikethrough.</span>
          </p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Subscript/Superscript</p>
        </td>
        <td>
          <p>This should be the 1<sup>st</sup> superscript. And the variable x<sub>i</sub> should have <em>i</em> as a subscript.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Small caps</p>
        </td>
        <td>
          <p>The next word, <span style="font-variant:small-caps;">Microsoft</span>, should be in small caps.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Combinations</p>
        </td>
        <td>
          <p>The word <em><strong>here</strong></em> should be bold <em>and</em> italic.</p>
          <p>The word <span style="text-decoration:underline;"><strong>here</strong></span> should be underline <em>and</em> bold.</p>
          <p>The last word in this sentence should have “everything”: <span style="text-decoration:underline;"><span style="text-decoration:line-through;"><em><strong>here</strong></em></span></span>.</p>
        </td>
      </tr>
    </table>
    <h2>Selected Word 2010 Document Styles</h2>
    <table class="WordWalkingStickTable">
      <tr>
        <td>
          <p>Block Text</p>
        </td>
        <td>
          <p>This Paragraph Style translates into the <code>blockquote</code> element:</p>
          <blockquote>
            <p>The W3C recommendation states that web page authors should not type quotation marks in the text when they’re using <code>blockquote</code>—</p>
          </blockquote>
          <p>To support the <code>cite</code> attribute of <code>blockquote</code> see the Content Control “Micro-Formats” below.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Cite</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>cite</code> element:</p>
          <p>The book One is about the second Arabic numeral.</p>
          <p>The <code>cite</code> element is also used in the Content Control “Micro-Formats” (see below).</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Code</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>code</code> element.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Definition</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>dfn</code> (“<a href="http://reference.sitepoint.com/html/dfn">defining instance</a>”) element:</p>
          <p>The word one represents the famous numeral of unity.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Preformatted</p>
        </td>
        <td>
          <p>This Paragraph Style is translated into the <code>pre</code> (“<a href="http://reference.sitepoint.com/html/pre">preformatted</a>”) element:</p>
          <pre xml:space="preserve">
We can indent words with spaces
—
    one
        two
            three
</pre>
          <p> </p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Sample</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>samp</code> (“<a href="http://reference.sitepoint.com/html/samp">sample</a>”) element.</p>
          <p>When counting, we can use words like: one, two or three.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>
            <span style="text-decoration:line-through;">HTML Typewriter</span>
          </p>
        </td>
        <td>
          <p>The assumption here is that this Word style maps to the <code>tt</code> (“<a href="http://reference.sitepoint.com/html/tt">teletype</a>”) element. It is recommended not to support this element so the Word style will be ignored as well.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>HTML Variable</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>var</code> (“<a href="http://reference.sitepoint.com/html/var">variable</a>”) element. According to reference.sitepoint.com:</p>
          <blockquote>
            <p>The var element is used to indicate that the text is a variable and shouldn’t be taken literally. Instead, it’s a placeholder where the contents should be replaced with your own value.</p>
          </blockquote>
          <p>It follows that the <code>var</code> style can be used inside the <code>code</code> style:</p>
          <p>We have <code>one, </code>&lt;your number&gt;, <code>three</code> in the sequence.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>List Bullet</p>
        </td>
        <td>
          <p>This style is translated into an unordered list (<code>ul</code>):</p>
          <ul>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
          </ul>
          <p> </p>
        </td>
      </tr>
      <tr>
        <td>
          <p>List Paragraph</p>
        </td>
        <td>
          <p>This style is translated into an ordered list (<code>ol</code>):</p>
          <ol>
            <li>One</li>
            <li>Two</li>
            <li>Three</li>
          </ol>
          <p> </p>
        </td>
      </tr>
      <tr>
        <td>
          <p>Quote</p>
        </td>
        <td>
          <p>This Character Style is translated into the <code>q</code> (“<a href="http://reference.sitepoint.com/html/q">quote</a>”) element:</p>
          <p>When counting, he said the words, “One, two, three…”</p>
        </td>
      </tr>
    </table>
    <h3>Warning: Character Styles Clash with Hyperlinks</h3>
    <p>In Microsoft Word, a Character Style like “HTML Code” will clash with the “Hyperlink” Character Style when text marked as HTML Code has a hyperlink assigned to it. The resultant Open XML Word Processing Markup Language might look like this:</p>
    <pre xml:space="preserve">
&lt;w:hyperlink&gt;
    &lt;w:r w:rsidRPr="002B526C"&gt;
        &lt;w:rPr&gt;
            &lt;w:rStyle w:val="Hyperlink" /&gt;
            &lt;w:rFonts w:ascii="Consolas"
                w:hAnsi="Consolas" w:cs="Consolas" /&gt;
            &lt;w:noProof /&gt;
        &lt;/w:rPr&gt;
        &lt;w:t&gt;samp&lt;/w:t&gt;
    &lt;/w:r&gt;
&lt;/w:hyperlink&gt;
</pre>
    <p>References to the font Consolas are the only clues that this Hyperlink style was once the HTML Code style.</p>
    <h2>Selected Characters</h2>
    <table class="WordWalkingStickTable">
      <tr>
        <td>
          <p>Line Break (<code>w:br</code> or <code>w:cr</code>)</p>
        </td>
        <td>
          <p>This sentence should break here<br />and then end.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>No-break hyphen.</p>
        </td>
        <td>
          <p>This sentence contains a word in italics, <em>censor-ious</em> that should not break at the <em>r</em> and <em>i</em>.</p>
        </td>
      </tr>
      <tr>
        <td>
          <p>No-break space.</p>
        </td>
        <td>
          <p> </p>
        </td>
      </tr>
    </table>
    <h2>Content Control “Micro-Formats”</h2>
    <p>Modern word processing file formats need a standard way to store metadata. The research of <a href="http://academic.research.microsoft.com/Author/3445875.aspx">Peter Sefton</a>, namely his work, “<a href="http://academic.research.microsoft.com/Paper/4937165.aspx">Embedding metadata and other semantics in word processing documents</a>,” details this issue. After <a href="http://kintespace.com/rasxlog/?p=2236">litigation in 2010</a>, Office Word 2010 has only <em>one</em> (legal) way to store metadata through the use of <a href="http://msdn.microsoft.com/en-us/library/bb157891.aspx">Content Controls</a>. Moreover, Office Word 2010 effectively stands alone, providing metadata entry <em>and</em> a robust <acronym title="Application Programming Interface">API</acronym> for access and manipulation.</p>
    <p>The WordWalkingStick utility supports “<a href="http://microformats.org/about">micro-formats</a>” that transform Content Controls into HTML. The following table summarizes:</p>
    <table class="WordWalkingStickTable">
      <tr>
        <td>
          <p>Acronym</p>
        </td>
        <td>
          <acronym title="Visual Studio Tools for the Microsoft Office System">VSTO</acronym>
        </td>
      </tr>
      <tr>
        <td>
          <p>Amazon.com Product Image</p>
        </td>
        <td>
          <a href="http://www.amazon.com/exec/obidos/ASIN/0735627045/thekintespacec00A/" title="Buy this product at Amazon.com!">
            <img alt="Amazon.com product" src="http://kintespace.com/bitmaps/clr_via_csharp_book.jpg" style="margin:16px;" />
          </a>
        </td>
      </tr>
      <tr>
        <td>
          <p>Image</p>
        </td>
        <td>
          <a href="http://www.flickr.com/photos/wilhite/4627255732/" title="New Books in the Labor Camp">
            <img alt="New Books in the Labor Camp" src="http://farm4.static.flickr.com/3388/4627255732_26e5fed444_m.jpg" style="margin:16px;" />
          </a>
        </td>
      </tr>
      <tr>
        <td>
          <p>CSS Block</p>
        </td>
        <td>
          <p>The next block of text is a CSS Block:</p>
          <div class="Note">
            <p>This is a block of text (<em>“rich”</em> text) in a Content Control that should export as ‘clean’ <acronym title="Extensible Hypertext Markup Language">XHTML</acronym> inside of a <code>div</code> element with a <acronym title="Cascading Style Sheet">CSS</acronym> class attribute of <code>class="Note"</code>.</p>
          </div>
          <p>This comes after the special block of text.</p>
        </td>
      </tr>
    </table>
    <p> </p>
  </body>
</html>